package com.dxy.lc.controller;

import com.dxy.lc.base.Resp;
import com.dxy.lc.model.entity.Todo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dxy.lc.service.TodoService;

import java.util.List;

/**
* <p>
*  controller
* </p>
*
* @author dxy
* @since 2024-12-06
*/
@Slf4j
@RestController
@RequestMapping("/lc/todo")
public class TodoController {

    @Autowired
    private TodoService service;

    @PostMapping("/edit")
    public Resp edit(@RequestBody Todo params){
        service.edit(params);
        return Resp.bizSuccess();
    }

    @GetMapping("/getByType")
    public Resp<List<Todo>> getByType(String type){
        return Resp.bizSuccess(service.getByType(type));
    }

}